#include <bits/stdc++.h>
// 2025/02/03
// tag: 
// Author: Zhang Muen

using namespace std;

int R[2000002], vis[2000002];
char a[2000002];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--) {
        memset(R, 0, sizeof(R));
        memset(a, 0, sizeof(a));
        memset(vis, 0, sizeof(vis));
        string s;
        cin >> s;
        int si = 1, p = 0, mx = 0;
        a[0] = '$', a[1] = '#';
        for (int i = 0; i < s.size(); i++)
            a[++si] = s[i], a[++si] = '#';
        for (int i = 1; i <= si; i++) {
            if (mx >= i)
                R[i] = min(R[2 * p - i], mx - i);
            while (a[i + R[i]] == a[i - R[i]])
                R[i]++;
            if (i + R[i] > mx)
                p = i, mx = i + R[i] - 1;
        }
        for (int i = si; i >= 1; i--) {
            if (i + R[i] - 1 == si)
                vis[i] = 1;
            else if (vis[i + R[i] - 2] && i == R[i])
                vis[i] = 1;
        }
        for (int i = 1; i <= si; i++)
            if (vis[i] && a[i] >= 'a' && a[i] <= 'z') 
                cout << i / 2 << " ";
        cout << endl;
    }
    return 0;
}
